package com.lzw.breezeNovel.webApp.service.impl.common;


import com.lzw.breezeNovel.webApp.mapper.common.AdvertisementMapper;
import com.lzw.breezeNovel.webApp.service.common.AdvertisementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.service.novel.impl
 * @date 2025/3/3
 * @description 广告的服务类
 */
@Service
@SuppressWarnings("all")
public class AdvertisementServiceImpl implements AdvertisementService {

    /**
     * 注入service
     */
    @Autowired
    private AdvertisementMapper advertisementMapper;


    /**
     * 根据广告位置获取广告
     * @param position
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<String> getAdvertisementByPosition(Integer position) {
        //根据广告位置获取广告
        List<String> advertisements = advertisementMapper.selectAdvertisementByPosition(position);
        return advertisements;
    }

    /**
     * 根据广告位置获取漫画
     * @param position
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<String> getComicByPosition(Integer position) {
        List comic = advertisementMapper.selectComicByPosistion(position);
        return comic;
    }

    /**
     * 根据广告位置获取视频
     * @param position
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<String> getVideoByPosition(Integer position) {
        List videos = advertisementMapper.selectVideoByPosistion(position);
        return videos;
    }

    /**
     * 根据广告位置获取AI
     * @param position
     * @return
     */
    @Override
    public List<String> getAiByPosition(Integer position) {
        List<String> ais = advertisementMapper.selectAiByPosition(position);
        return ais;
    }
}
